<template>
  <div class="home-center">
    <el-input
      placeholder="请输入搜索内容"
      v-model="keywordseach"
      icon="iconfont icon-search"
      @keydown.enter.native="getSearchs" 
    >
    </el-input>
    <!-- <p>{{singerlist}}</p> -->
  </div>
</template>

<script>
import Seach from './seach/Seach'
import {EventBus} from '../../components/unite/EventBus'
export default {
  name: 'HomeCenter',
  components: {
   Seach
  },
  data() {
    return {
        keywordseach: '',//要输入的内容
      }
  },
  //生命周期函数
  created(){
    // //默认加载请求数据
    // this.getSearch()
  },
  methods: {
    getSearchs() {
      if(this.keywordseach === ''){
      return  console.log('您输入的内容为空');
      }
      if(this.$router.name !== 'seach'){
        this.$router.push('/home/seach')
      }
        // this.$bus.$emit('btnkeyword',this.keywordseach)
        EventBus.$emit('btnkeyword',this.keywordseach)
        // console.log($bus+"我是bus");
        console.log(this.keywordseach);
  },
 }
}
</script>

<style lang="less">
.home-center {
  display: flex;
  width: 600px;
  line-height: 78px;
}
.el-input__inner {
  margin: auto 0;
  margin-left: 280px;
  width: 300px;
  border-radius: 20px;
}
</style>
